<?php

namespace app\admin\model;

use think\Model;

class PurchaseReceiptDetails extends Model
{
    public function ordersDetail()
    {
        return $this->hasOne('PurchaseOrdersDetail', 'id', 'purchase_orders_detail_id')->bind(['unit_price']);
    }

    public function inventory()
    {
        return $this->hasOne('Inventory', 'id', 'inventory_id')->bind([
            'initial_qty' => 'initial_qty',
            'convertible_qty' => 'convertible_qty',
            'available_qty' => 'available_qty',
            'lock_qty' => 'lock_qty',
            'arrival_date' => 'arrival_date',
            'real_arrival_date' => 'real_arrival_date',
            'is_futures' => 'is_futures',
            'productid' => 'productid',
            'wid' => 'wid',
        ]);
    }

    public function product()
    {
        return $this->hasOne('Product', 'id', 'productid')->bind([
            'cname' => 'cname',
            'code' => 'code',
        ]);
    }
}
